<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<head th:replace="common/head :: common_head(~{::title},~{})">
  <title>财税风险分析系统  | 交易记录</title>
</head>

<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <div th:replace="common/header-user :: header"></div>
  
  <div th:replace="common/aside-user :: aside"></div>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
  
    <section class="content-header">
      <h1 id="page-title" active-aside="account-aside" active-menu="transaction-history-menu">交易记录
        <small></small>
      </h1>
      <ol class="breadcrumb">
        <li>账号中心</li>
        <li class="active"><i class="fa fa-money"></i> 交易记录</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content container-fluid">
      <div class="row">
        <div class="col-sm-12">
          <div class="box">
            <div class="box-header with-border">
              <form id="searchForm" class="form-horizontal">
			          <div class="form-group">
			            <label for="" class="col-sm-2 control-label" style="text-align: left;">交易时间</label>
			            <div class="col-sm-4">
			              <select class="form-control" name="createTime">
			                <option value="">全部</option>
			                <option value="oneWeek">一周内</option>
			                <option value="oneMonth">一月内</option>
			                <option value="threeMonth">三月内</option>
			                <option value="halfYear">半年内</option>
			                <option value="oneYear">一年内</option>
			              </select>
			            </div>
			          </div>
			          <div class="form-group" style="height: 34px;">
			            <label for="" class="col-sm-2 control-label" style="text-align: left;">交易类型</label>
			            <div class="col-sm-2">
			              <div class="checkbox">
			                <label>
                        <input type="checkbox" name="type" value="PURCHASE"> 购买
	                    </label>
	                  </div>
	                </div>
	                <div class="col-sm-2">
	                  <div class="checkbox">
	                    <label>
	                      <input type="checkbox" name="type" value="BONUS"> 入账
	                    </label>
	                  </div>
	                </div>
	                <div class="col-sm-6">
	                  <div class="checkbox">
                      <label>
                        <input type="checkbox" name="type" value="WITHDRAW"> 提现
                      </label>
                    </div>
			            </div>
			          </div>
			          <div class="form-group">
                  <label for="" class="col-sm-2 control-label" style="text-align: left;">交易状态</label>
                  <div class="col-sm-2">
                    <div class="checkbox">
                      <label>
                        <input type="checkbox" name="status" value="PENDING_PAYMENT"> 待支付
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-2">
                    <div class="checkbox">
                      <label>
                        <input type="checkbox" name="status" value="PROCESSING"> 处理中
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-2">
                    <div class="checkbox">
                      <label>
                        <input type="checkbox" name="status" value="FNISHED"> 已完成
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-4">
                    <div class="checkbox">
                      <label>
                        <input type="checkbox" name="status" value="CANCELED"> 已取消
                      </label>
                    </div>
                  </div>
                </div>
		          </form>
            </div>
            <div class="box-body">
		          <table id="transactionTable" class="table table-bordered table-hover">
			          <thead>
			            <tr>
			              <th>交易时间</th>
			              <th>描述</th>
			              <th>金额</th>
			              <th>状态</th>
			              <th>账户余额</th>
			            </tr>
		            </thead>
		            <tbody>
			            <tr>
			              <td></td>
			              <td></td>
			              <td></td>
			              <td></td>
			              <td></td>
			            </tr>
		            </tbody>
		          </table>
	          </div>
          </div>
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  
  <div th:replace="common/footer :: footer"></div>

  <!-- Add the sidebar's background. This div must be placed
  immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<div th:replace="common/script :: script"></div>
<script>
	var table;
	$(function () {
	  table = $('#transactionTable').DataTable({
	    'paging'      : true,
	    'lengthChange': false,
	    'searching'   : false,
	    'ordering'    : false,
	    'info'        : false,
	    'autoWidth'   : false,
	    "ajax": "/client/systemLogs/transaction/data/oneWeek?" + $('#searchForm').serialize(),
	    "columns": [
	        { "data": function(data) {
	        	return data.createTime.substring(0, 10);
	        } },
	        { "data": "description" },
	        { "data": function(data) {
	        	return formatMoney(data.amount);
	        } },
	        { "data": function(data) {
	          switch(data.status) {
	          case 'PENDING_PAYMENT':
	            return "待支付";
	            break;
	          case 'PROCESSING':
	              return "处理中";
	              break;
	          case 'FNISHED':
	            return "已完成";
	            break;
	          case 'CANCELED':
              return "已取消";
              break;
	          default:
	            return "";
	          }
	        } },
	        { "data": function(data) {
	            return formatMoney(data.accountBalance);
          } }
	    ],
	    language:{
	        "sProcessing":   "处理中...",
	        "sZeroRecords":  "没有匹配结果",
	        "sInfo":         "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
	        "sInfoEmpty":    "显示第 0 至 0 项结果，共 0 项",
	        "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
	        "sInfoPostFix":  "",
	        "sSearch":       "搜索:",
	        //"sUrl":          "",
	        "sEmptyTable":     "表中数据为空",
	        "sLoadingRecords": "载入中...",
	        "sInfoThousands":  ",",
	        "oPaginate": {
	            "sFirst":    "首页",
	            "sPrevious": "上页",
	            "sNext":     "下页",
	            "sLast":     "末页"
	        },
	        "oAria": {
	            "sSortAscending":  ": 以升序排列此列",
	            "sSortDescending": ": 以降序排列此列"
	        }
	    }
		  
	  });
	  
	  $('select').change(function() {
		  table.ajax.url("/client/systemLogs/transaction/data/oneWeek?" + $('#searchForm').serialize()).load();
	  });
	  
	  $('input').change(function() {
		  table.ajax.url("/client/systemLogs/transaction/data/oneWeek?" + $('#searchForm').serialize()).load();
    });
	  
	});
	  
</script>
</body>
</html>